<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>


<!DOCTYPE html>
<html:html lang="true">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><bean:message key="welcome.title"/></title>
        <link href="css/mini3537.css?files=reset,common,form,standard,960.gs.fluid,simple-lists,block-lists,planning,table,calendars,wizard,gallery" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
        <link rel="icon" type="image/png" href="favicon-large.png">
        <script type="text/javascript" src="js/miniab15.php?files=html5,jquery-1.4.2.min,old-browsers,jquery.accessibleList,searchField,common,standard,jquery.tip,jquery.hashchange,jquery.contextMenu,list"></script>
        <html:base/>
    </head>
    <body >
        <%@ include file="/Header.jsp"%>

        <!-- ####################                  Vertical Menu                    ########################## -->
        <%@ include file="/verticalmenu.jsp"%>

        <!-- ####################                  Vertical Menu                    ########################## -->

        <!-- *************************************** Content *************************************************** -->
    <section class="grid_9">
        <div class="block-border"><div class="block-content">
                <!-- We could put the menu inside a H1, but to get valid syntax we'll use a wrapper -->
                <div class="h1 with-menu">
                    <h1>Web stats</h1>
                </div>

                <div class="block-controls">

                    <ul class="controls-tabs js-tabs same-height with-children-tip">
                        <li><a href="#tab-stats" title="Charts"><img src="images/icons/web-app/24/Bar-Chart.png" width="24" height="24"></a></li>
                        <li><a href="#tab-comments" title="Comments"><img src="images/icons/web-app/24/Comment.png" width="24" height="24"></a></li>
                        <li><a href="#tab-medias" title="Medias"><img src="images/icons/web-app/24/Picture.png" width="24" height="24"></a></li>
                        <li><a href="#tab-users" title="Users"><img src="images/icons/web-app/24/Profile.png" width="24" height="24"></a></li>
                        <li><a href="#tab-infos" title="Informations"><img src="images/icons/web-app/24/Info.png" width="24" height="24"></a></li>
                    </ul>

                </div>

                <html:form styleClass="form"  action="user.do"  styleId="user">

                    <fieldset class="grey-bg">
                        <legend><a href="#">Options</a></legend>

                        <div class="float-left gutter-right">
                            <label for="stats-period">Full Name</label>
                            <span class="input-type-text">
                                <html:text name="userForm" property="name" styleId="name"></html:text></span>
                        </div>
                        <div class="float-left gutter-right">
                            <label for="stats-period">User Name</label>
                            <span class="input-type-text">
                                <html:text property="userName" name="userForm" styleId="userName"></html:text></span>
                        </div>
                        <div class="float-left gutter-right">
                            <label for="stats-period">PassWord</label>
                            <span class="input-type-text">
                                <html:text property="pass" styleId="pass" ></html:text></span>
                        </div>


                        <div class="float-left gutter-right">
						 <label for="stats-period">Role</label>
							<p class="input-height grey-bg">
									<html:radio property="position" value="true" styleId="position" ></html:radio>
									&nbsp;<label
									for="complex-fr-active-1">Admin</label> 
									<html:radio property="position" value="false" styleId="position2"></html:radio>
									&nbsp;<label
									for="complex-fr-active-0">User</label>
							</p>
						</div>
                    </fieldset>
               
                
                <ul class="message no-margin">

                    <button  class="red" onclick="cancel()" >Cancel</button>
                    <button type="reset" class="grey">Reset</button>
                    <button  onclick="saveUser()" id="btSave"><img src="images/icons/fugue/tick-circle.png" width="16" height="16"> Save</button>

                </ul>
                     </html:form>
            </div></div>
    </section>


    <!-- *************************************** Content *************************************************** -->
</article>
<!--Footer-->
<%@ include file="/Footer.jsp"%>
<!-- Footer -->
</body>
</html:html>
<script language="javascript">
    var type = '<%=(String)request.getAttribute("type")%>';
    id = '<%=(String)request.getAttribute("id")%>';
    function saveUser()
	{
            if(type=='add'){
                document.getElementById("user").action = 'user.do?method=addUser&type=add';
                document.getElementById("user").submit();
            }else{
                document.getElementById("user").action = 'user.do?method=editUser&type=edit&id='+ id
		document.getElementById("user").submit();
            }
		
            
	}
    
    function cancel(){
        document.getElementById("user").action = '/NTB/user.do?method=getAllUser'
        document.getElementById("user").submit();
    }
    function loadForm(){
    	hiddentControl();
    }
    function hiddentControl(){ 
        if(type == "detail"){
            document.getElementById("name").disabled=true;
            document.getElementById("userName").disabled=true;
            document.getElementById("pass").disabled=true;
            document.getElementById("position").disabled=true;
            document.getElementById("position2").disabled=true;              
            document.getElementById("btSave").disabled=true ;   
        }
    }
</script>